﻿/* ######################################## *\
 * ### Copyright (C) 2009 AJ Ravindiran ### *
\* ######################################## */
using System;

using AJRavindiran.Jolt.RuneScape.Database;
using AJRavindiran.Jolt.RuneScape.Events;
using AJRavindiran.Jolt.RuneScape.Models;
using AJRavindiran.Jolt.RuneScape.Network.Login;
using AJRavindiran.Jolt.RuneScape.Network.Packets;
using AJRavindiran.Jolt.RuneScape.Workers;

namespace AJRavindiran.Jolt.RuneScape
{
    /// <summary>
    /// Represents a runescape mmorpg game.
    /// </summary>
    public class RuneScape
    {
        #region Fields
        private static LoginServer loginServer = new LoginServer();
        private static GameEngine gameEngine = new GameEngine();

        private static CharacterManager characterManager = new CharacterManager();
        private static AccountManager accountManager = new AccountManager();
        private static WorldManager worldManager = new WorldManager();
        private static ItemManager itemManager = new ItemManager();
        private static OffenseManager offenseManager = new OffenseManager();
        private static ConfigManager configManager = new ConfigManager();
        private static PacketManager packetManager = new PacketManager();
        private static EventManager eventManager = new EventManager();
        #endregion Fields

        #region Methods
        /// <summary>
        /// Itializes the runescape gaming environment.
        /// </summary>
        public static void Initialize()
        {
            // Start all the workers.
            gameEngine.Start();

            //Everything was scucessfully setup now.
            Jolt.GetLog().WriteInfo("Successfully set up a new gaming environment.");
            Jolt.GetLog().WriteBlank();
        }

        /// <summary>
        /// Accessor for the game engine instance.
        /// </summary>
        public static GameEngine GetGameEngine()
        {
            return gameEngine;
        }

        /// <summary>
        /// Accessor for the login server instance.
        /// </summary>
        public static LoginServer GetLoginServer()
        {
            return loginServer;
        }

        /// <summary>
        /// Accessor for the character manager instance.
        /// </summary>
        public static CharacterManager GetCharacterManager()
        {
            return characterManager;
        }

        /// <summary>
        /// Accesor for the account manager instance.
        /// </summary>
        public static AccountManager GetAccountManager()
        {
            return accountManager;
        }

        /// <summary>
        /// Accessor for the world manager instance.
        /// </summary>
        public static WorldManager GetWorldManager()
        {
            return worldManager;
        }

        /// <summary>
        /// Accessor for the ite manager instance.
        /// </summary>
        public static ItemManager GetItemManager()
        {
            return itemManager;
        }

        /// <summary>
        /// Accessor for the offense manager instance.
        /// </summary>
        public static OffenseManager GetOffenceManager()
        {
            return offenseManager;
        }

        /// <summary>
        /// Accessor for the configuration manager instance.
        /// </summary>
        public static ConfigManager GetConfigManager()
        {
            return configManager;
        }

        /// <summary>
        /// Accessor for the packet manager instance.
        /// </summary>
        public static PacketManager GetPacketManager()
        {
            return packetManager;
        }

        /// <summary>
        /// Accessor for the event manager instance.
        /// </summary>
        public static EventManager GetEventManager()
        {
            return eventManager;
        }
        #endregion Methods
    }
}
